import request from '@/utils/request'

export function getQrCode(params) {
  return request({
    url: '/oauth/authorize/qrcode',
    method: 'POST',
    data: params,
    responseType: 'blob'
  })
}

export function getDuQrCode(params) {
  return request({
    url: '/du/oauth',
    method: 'GET',
    params: params
  })
}

export function getQrCodeState(params) {
  return request({
    url: '/oauth/authorize/qrcode/status',
    method: 'GET',
    params
  })
}

export function getAliPanData(params) {
  return request({
    url: '/openFile/list',
    method: 'GET',
    params,
    headers: {
      // Referer: 'https://www.aliyundrive.com/'
    }
  })
}

export function reloadRefreshToken(params) {
  return request({
    url: '/auth/refresh_token',
    method: 'GET',
    params
  })
}
export function handleFileDownloadLogic(params) {
  return request({
    url: '/auth/file/download',
    method: 'POST',
    data: params
  })
}
export function getFileDetail(params) {
  return request({
    url: '/auth/file/detail',
    method: 'POST',
    data: params
  })
}

export function getDuPanFileListLogic(params) {
  return request({
    url: '/du/file/list/normal',
    method: 'GET',
    params: params
  })
}

export function getFileDetailLogic(params) {
  return request({
    url: '/du/file/detail',
    method: 'GET',
    params: params
  })
}

export function getVideoStreaming(params) {
  return request({
    url: '/du/file/streaming',
    method: 'GET',
    params: params
  })
}

export function getDownloadLink(params) {
  return request({
    url: '/du/file/download',
    method: 'GET',
    params: params,
    responseType: 'blob'
  })
}
